
<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
<!--#header start-->
{include file="public/_meta" /}
<!--#header end-->

<title>修改用户</title>
<meta name="keywords" content="admin">
<meta name="description" content="admin">
</head>
<body>
<article class="page-container">
	<form action="" method="post" class="form form-horizontal" id="form-member-add">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>用户名：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$user.name}" placeholder="name" id="name" name="name">
        <input type="hidden" name="id" value="{$user.id}">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>手机：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$user.phone}" placeholder="mobile" id="mobile" name="phone">
			    <label for="mobile" class="label label-secondary radius">可用于登录</label>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>邮箱：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="email" class="input-text"  value="{$user.email}" placeholder="xx@example.com" name="email" id="email" disabled="">
			  <label for="email" class="label label-warning radius">已验证邮箱，不能再修改</label>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">权限分组：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<span class="select-box">
					<select class="select" size="1" name="group_id">
              {volist name="group" id="list"}
								{if condition="$list.id == $user.group_id"}
									<option value="{$list.id}" selected="selected" >{$list.title}</option>
								{else /}
									<option value="{$list.id}" >{$list.title}</option>
								{/if}
              {/volist}
					</select>
				</span>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>状态：</label>
			<div class="formControls col-xs-8 col-sm-9 skin-minimal">
				<div class="radio-box">
					{if condition="$user.status"}
					    <input name="status" type="radio" id="status-1" checked value="1">
					{else /}
					    <input name="status" type="radio" id="status-1" value="1">
					{/if}
					<label for="status-1">启用</label>
				</div>
				<div class="radio-box">
					{if condition="$user.status"}
							<input name="status" type="radio" id="status-2" value="0">
					{else /}
							<input name="status" type="radio" id="status-2" checked value="0">
					{/if}
					<label for="status-2">禁用</label>
				</div>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">备注：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea name="remark" class="textarea"  placeholder="说点什么...最少输入10个字符" onKeyUp="$.Huitextarealength(this,100)">{$user.remark}</textarea>
				<p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</article>

<!--#header start-->
{include file="public/_footer" /}
<!--#header end-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__ADMIN__/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="__ADMIN__/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="__ADMIN__/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});

	$("#form-member-add").validate({
		rules:{
			name:{
				required:true,
				minlength:2,
				maxlength:16
			},
			status:{
				required:true,
			},
			phone:{
				required:true,
				isMobile:true,
			},
			email:{
				required:true,
				email:true,
			}
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
            	$(form).ajaxSubmit({
				type: 'put',
				url: "{:url('AdminUser/edit')}" ,
				success: function(result){
					if (result.state) {
						layer.msg(result.msg,{icon:1,time:1000});
						setTimeout(function(){
							 layer.closeAll('loading');
							 var index = parent.layer.getFrameIndex(window.name);
							 parent.layer.close(index);
						}, 2000);
					}else {
						layer.msg(result.msg,{icon:5,time:1000});
					}
				},
					error: function(XmlHttpRequest, textStatus, errorThrown){
					layer.msg('网络连接失败!',{icon:5,time:1000});
				}
			});

		}
	});
});
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>
